home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9114 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  49 lines

  1. Path: library.erc.clarkson.edu!rpi!not-for-mail
  2. From: kasslar@aol.com (Kasslar)
  3. Newsgroups: comp.lang.c++,comp.lang.c++.moderated
  4. Subject: Re: Argc & Argv
  5. Date: 28 Feb 1996 03:30:02 -0000
  6. Organization: America Online, Inc. (1-800-827-6364)
  7. Sender: cppmods@netlab.cs.rpi.edu
  8. Approved: herbs@connobj.com
  9. Message-ID: <4h0i7q$4sg@netlab.cs.rpi.edu>
  10. References: <4gta9f$df5@netlab.cs.rpi.edu>
  11. Reply-To: kasslar@aol.com (Kasslar)
  12. NNTP-Posting-Host: netlab.cs.rpi.edu
  13. X-Original-Date: 27 Feb 1996 14:54:16 -0500
  14.  
  15. You can never explicitly call a constructor, and since your objects in
  16. this case are global they must be constructed out side of main. No can do.
  17. How 'bout Global pointers to your objects and constucting the objects on
  18. the free store in main?
  19.  
  20. T * po;
  21.  
  22. void main( int argc, char ** argv )
  23. {
  24.    po = new T(argv);
  25. }
  26.  
  27.  
  28. The other option is to of course write a method for your global that main
  29. can call to pass argv in.
  30.  
  31. Regards,
  32. Randy Abernethy
  33. ----------------------------------------
  34. Randy Abernethy
  35. Kasslar Enterprises
  36. kasslar@aol.com
  37. randya@spectralinc.com
  38. rabernethy@spectralinc.com
  39. ----------------------------------------
  40.  
  41. Randy Abernethy
  42. Kasslar Enterprises
  43. kasslar@aol.com
  44.  
  45.       [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
  46.       [  Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm  ]
  47.       [  Moderation policy: http://www.connobj.com/cpp/guide.htm  ]
  48.       [      Comments? mailto:c++-request@netlab.cs.rpi.edu       ]
  49.